﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

using SpiritAlight.Character;
using SpiritAlight.Input;
using SpiritAlight.Stage;
using SpiritAlight.SceneManagement;
using SpiritAlight.Scene;
namespace SpiritAlight.Character.Unit.EntitySpirit
{
    class Spirit1 : ASpirit
    {
        #region フィールド

        static Texture2D[,] texture = new Texture2D[4, 3];

        static Vector2 mySize = new Vector2(80.0f, 120.0f);

        #endregion


        #region プロパティ

        protected override UnitStatus Status
        {
            get { return status; }
            set { status = value; }
        }
        static UnitStatus status = new UnitStatus();

        /// <summary>
        /// ロード完了フラグ
        /// </summary>
        public override bool IsLoaded
        {
            get { return isLoaded; }
            protected set
            {
                if (!isLoaded)
                    isLoaded = value;
            }
        }
        static bool isLoaded = false;

        #endregion


        #region メソッド

        public Spirit1(float inPosX, float inPosY)
            :base()
        {
            Position = new Vector2(inPosX, inPosY);
            base.State = CharacterState.Wait;
            Initialize();
        }

        public Spirit1(Vector2 inPosition)
            : base()
        {
            Position = inPosition;
            base.State = CharacterState.Wait;
            Initialize();
        }


        public override void Initialize()
        {
            IsSelect = false;
            //ユニットステータス初期化
            Status.Size = new Vector2(80.0f, 120.0f);
            Status.AttackInterval = 100;
            Status.HitPoint = 50;
            Status.Power = 1;
            Status.RangeAttackOperation = 0.0f;
            Status.RangeSearchOperation = 0.0f;

            base.Initialize();
        }

        public override void LoadContent()
        {
            //読み込み済みなら終了
            if (IsLoaded)
                return;

            //素材が上がり次第読み込み
            texture[0, 0] = SceneManager.Content.Load<Texture2D>("Character/Army/Spirit1/back");
            //texture[0, 1] = SceneManager.Content.Load<Texture2D>("Character/Army/Player/back_damage");
            //texture[0, 2] = SceneManager.Content.Load<Texture2D>("Character/Army/Player/back_magic");
            texture[1, 0] = SceneManager.Content.Load<Texture2D>("Character/Army/Spirit1/front");
            //texture[1, 1] = SceneManager.Content.Load<Texture2D>("Character/Army/Player/front_damage");
            //texture[1, 2] = SceneManager.Content.Load<Texture2D>("Character/Army/Player/front_magic");
            texture[2, 0] = SceneManager.Content.Load<Texture2D>("Character/Army/Spirit1/left");
            //texture[2, 1] = SceneManager.Content.Load<Texture2D>("Character/Army/Player/left_damage");
            //texture[2, 2] = SceneManager.Content.Load<Texture2D>("Character/Army/Player/left_magic");
            texture[3, 0] = SceneManager.Content.Load<Texture2D>("Character/Army/Spirit1/right");
            //texture[3, 1] = SceneManager.Content.Load<Texture2D>("Character/Army/Player/right_damage");
            //texture[3, 2] = SceneManager.Content.Load<Texture2D>("Character/Army/Player/right_magic");
            base.LoadContent();
        }

        public override void Update( )
        {
            base.Update();
        }

        public override void Draw()
        {
            GameMain.DrawObject(texture[(int)Direction, (int)State], Position - Camera.Position);
        }


        #endregion
    }
}
